<template>
  <div class="home">
    <el-card>
      <div>
        <el-button type="success" icon="el-icon-refresh" size="medium" @click="refresh">刷新</el-button>
      </div>
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        class="elTable"
        row-key="id"
      >
        <el-table-column type="index" label="序号" width="100" align="center"/>
        <el-table-column prop="menuName" label="菜单名称" align="center"/>
        <el-table-column prop="title" label="菜单描述" align="center"/>
        <el-table-column label="创建时间" align="center" prop="createTime">
          <template slot-scope="scope">
            {{ scope.row.createTime }}
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
  import { queryAllMenu } from "@/api/userControl/menuControl"

  export default {
    data() {
      return {
        tableData: []
      }
    },
    created() {
      this.getList()
    },
    mounted() {
    },
    methods: {
      refresh() {
        this.getList()
      },
      async getList() {
        const { object } = await queryAllMenu()
        if (object) {
          this.tableData = object
          // this.total = object.count
        }
      }
    }
  }
</script>

<style scoped lang="scss"></style>
